﻿using System.Windows.Data;
using System;
using System.Windows;

namespace BizControl.Presentation.Infrastructure.Converters
{
  public class BoolFalseToVisibilityConverter : IValueConverter
  {
    #region IValueConverter Members

    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
      bool valueAsBool;
      if (bool.TryParse(value.ToString(), out valueAsBool))
        if (!valueAsBool) return Visibility.Visible;
      return Visibility.Collapsed;
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
      return null;
    }

    #endregion
  }
}
